/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_ORGAO_UNIDADE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrgaoUnidade.findAll", query = "SELECT o FROM OrgaoUnidade o"),
    @NamedQuery(name = "OrgaoUnidade.findByOguId", query = "SELECT o FROM OrgaoUnidade o WHERE o.oguId = :oguId"),
    @NamedQuery(name = "OrgaoUnidade.findByOguCdIgnaoespacialpoligono", query = "SELECT o FROM OrgaoUnidade o WHERE o.oguCdIgnaoespacialpoligono = :oguCdIgnaoespacialpoligono")})
public class OrgaoUnidade implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "OGU_ID")
    private BigDecimal oguId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "OGU_CD_IGNAOESPACIALPOLIGONO")
    private BigInteger oguCdIgnaoespacialpoligono;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pcdOguOperador")
    private List<Pcd> pcdList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pcdOguResponsavel")
    private List<Pcd> pcdList1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvhOguOperador")
    private List<CaracterizacaoVhm> caracterizacaoVhmList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvhOguResponsavel")
    private List<CaracterizacaoVhm> caracterizacaoVhmList1;
    @JoinColumn(name = "OGU_UND_ID", referencedColumnName = "UND_ID")
    @ManyToOne(optional = false)
    private Unidade oguUndId;
    @JoinColumn(name = "OGU_ORG_ID", referencedColumnName = "ORG_ID")
    @ManyToOne(optional = false)
    private Orgao oguOrgId;

    public OrgaoUnidade() {
    }

    public OrgaoUnidade(BigDecimal oguId) {
        this.oguId = oguId;
    }

    public OrgaoUnidade(BigDecimal oguId, BigInteger oguCdIgnaoespacialpoligono) {
        this.oguId = oguId;
        this.oguCdIgnaoespacialpoligono = oguCdIgnaoespacialpoligono;
    }

    public BigDecimal getOguId() {
        return oguId;
    }

    public void setOguId(BigDecimal oguId) {
        this.oguId = oguId;
    }

    public BigInteger getOguCdIgnaoespacialpoligono() {
        return oguCdIgnaoespacialpoligono;
    }

    public void setOguCdIgnaoespacialpoligono(BigInteger oguCdIgnaoespacialpoligono) {
        this.oguCdIgnaoespacialpoligono = oguCdIgnaoespacialpoligono;
    }

    @XmlTransient
    public List<Pcd> getPcdList() {
        return pcdList;
    }

    public void setPcdList(List<Pcd> pcdList) {
        this.pcdList = pcdList;
    }

    @XmlTransient
    public List<Pcd> getPcdList1() {
        return pcdList1;
    }

    public void setPcdList1(List<Pcd> pcdList1) {
        this.pcdList1 = pcdList1;
    }

    @XmlTransient
    public List<CaracterizacaoVhm> getCaracterizacaoVhmList() {
        return caracterizacaoVhmList;
    }

    public void setCaracterizacaoVhmList(List<CaracterizacaoVhm> caracterizacaoVhmList) {
        this.caracterizacaoVhmList = caracterizacaoVhmList;
    }

    @XmlTransient
    public List<CaracterizacaoVhm> getCaracterizacaoVhmList1() {
        return caracterizacaoVhmList1;
    }

    public void setCaracterizacaoVhmList1(List<CaracterizacaoVhm> caracterizacaoVhmList1) {
        this.caracterizacaoVhmList1 = caracterizacaoVhmList1;
    }

    public Unidade getOguUndId() {
        return oguUndId;
    }

    public void setOguUndId(Unidade oguUndId) {
        this.oguUndId = oguUndId;
    }

    public Orgao getOguOrgId() {
        return oguOrgId;
    }

    public void setOguOrgId(Orgao oguOrgId) {
        this.oguOrgId = oguOrgId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (oguId != null ? oguId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrgaoUnidade)) {
            return false;
        }
        OrgaoUnidade other = (OrgaoUnidade) object;
        if ((this.oguId == null && other.oguId != null) || (this.oguId != null && !this.oguId.equals(other.oguId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.OrgaoUnidade[ oguId=" + oguId + " ]";
    }
    
}
